﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter2.Section4
{
    public class Example05
    {
        public Example05()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double, double[]> map
                = new V.Function.ToLastType<double, double[]>(func);
            V.Path p = new V.Path(map);
  
            V.TangentVector v = new V.TangentVector(p,0.0);
            v.Find();
            for (int i = 0; i < v.Result.Length; i++)
            {
                result += v.Result[i].ToString() + "\t  ";                
            }
            result += "\r\n";

            v.Time = 1.0;
            v.Find();
            for (int i = 0; i < v.Result.Length; i++)
            {
                result += v.Result[i].ToString() + "\t  ";
            }
            result += "\r\n";
        }
        private double[] func(double t)
        {
            double[] r = new double[3];
            r[0] = t;
            r[1] = t*t;
            r[2] = Math.Exp(t);
            return r;
        }
    }
}
// 1	  0	  0.999999999999987	  
// 0.999999999999923	  1.9999999999999	  2.71828182845936
